package DAO;


import metier.RecompensePersonne;

public class DAORecompensePersonneJPA extends DAORecompenseJPA implements DAORecompensePersonne{

	private static DAORecompensePersonneJPA instance=null;
	
	private DAORecompensePersonneJPA() {}
	
	public static DAORecompensePersonneJPA getInstance() {
		if(instance == null)
			instance = new DAORecompensePersonneJPA();
		return instance;
	}

	@Override
	public RecompensePersonne get(int id) {
		RecompensePersonne recompense = DAOJPA.getManager().find(RecompensePersonne.class, id);
		return recompense;
	}

	@Override
	public void save(RecompensePersonne recompense) {
		if(recompense.getId() != -1)
			throw new IllegalArgumentException("Recompense d�ja enregistr�e");

		DAOJPA.getManager().persist(recompense);
		DAOJPA.commit();
	}


}
